1. Field of the Invention
This invention generally relates to computer graphics and more specifically to a system and method for distributing photons when rendering an image using photon mapping.
2. Description of the Background Art
Global illumination is a lighting technique in computer graphics that attempts to compute all light interactions within a scene to obtain a photorealistic image. Global illumination mimics the subtleties of natural light by tracing the light rays bouncing between a collection of radiating objects in the scene and incorporating the diffuse color properties of those objects in the reflected light rays. Accounting for these inter-reflected light rays when rendering an image of the scene produces a much more realistic image since, among other things, the light scattered and diffused throughout the environment creates more accurate tones and shadows.
The computational intensity of global illumination rendering has made implementing this lighting technique in commercial rendering products historically impractical. However, with recent advances in graphics processing, global illumination rendering has become more commercially feasible. One well-known method used for calculating fast and accurate solutions to the global illumination problem is photon mapping, which is an extension of ray tracing. Photon mapping is a two-pass algorithm. The first pass consists of tracing photons from the light sources in a scene and storing these photons in a photon map as they interact with elements in the scene. The second pass consists of rendering, where the photon map is used to provide estimates of the reflected radiance of the different surfaces in the scene.
Generally, a quality-computation time trade-off exists for photon mapping. On the one hand, the more photons emitted from each light source in a scene during photon mapping, the higher the quality of the rendered image of the scene. On the other hand, however, computation time is proportional to the number of photons used for photon mapping. So, for example, doubling the number of photons to improve image quality may double computation time.
Another characteristic of photon mapping (and global illumination, generally) is that certain light sources in the scene may have greater influence on image quality than other light sources. For example, bright light sources tend to have a disproportionate effect on image quality compared to dim light sources. Thus, in theory, one way to increase image quality is to identify the brightest light sources in a scene and then allocate more photons to those light sources when rendering an image of the scene using photon mapping.
A significant drawback of commercial renderers that implement photon mapping is that the graphics artist designing a scene usually has to designate the number of photons to be emitted from each of the different light sources in the scene during the photon mapping step. This approach causes several problems. First, as described above, to increase image quality, the graphics artist may try to determine which light sources in the scene influence image quality the most and then allocate more photons to those light sources for photon mapping. Making such determinations is quite difficult given the technical complexity of most rendering applications and may oftentimes lead to a time consuming trial-and-error process. Therefore, the graphics artist may simply increase the number of photons allocated to each of the light sources in the scene to increase overall image quality. But, as also described above, increasing the total number of photons for photon mapping may dramatically increase overall computation time (as well as adversely affect system memory requirements). These problems are exacerbated when light sources are added or removed from the scene or when the energy level of one or more light sources in the scene changes over time. In each situation, for example, the graphics artist must reallocate photons to the different light sources in the scene to account for the new lighting environment.
What is needed in the art is a technique for systematically distributing photons to the different light sources in a scene in a way that optimizes the trade-off between image quality and computation time.